

use winit::event_loop::EventLoop;

use crate::{config::AliceConfig, math::Vector2u};

use super::{winit_window::WinitWindow, window_config::MainWindowConfig};







pub struct AliceWindow {
    pub window: WinitWindow,
    pub window_config:MainWindowConfig,
}


impl AliceWindow {
    pub fn new(event_loop: &EventLoop<()>,config:&AliceConfig) -> Self{
     
        println!("WindowSystem::new()");

        let window_size = config.get_window_size();
        let window_name = config.get_project_name();
        let window_config = MainWindowConfig::new(window_name.to_string(),window_size.x,window_size.y);
        let window = WinitWindow::new(&event_loop,&window_config);
        AliceWindow {
            window,
            window_config,
        }
    
    }

    pub fn initialize(&mut self){
        // self.window.initialize(engine);
    }

    pub fn run(self){
    }

    pub fn resize(&mut self , size:Vector2u) {
        self.window.set_window_size(size)
    }

    pub fn set_project_title(&mut self,name:& str) {
        self.window.set_title(name)
    }

    pub fn request_draw(&mut self){
        self.window.get_window().request_redraw();
    }

    pub fn get_window(&self) -> &winit::window::Window {
        self.window.get_window()
    }
}





